package com.wfx.controller;


import com.wfx.entity.*;
import com.wfx.service.ISysModuleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhu
 * @since 2021-01-22
 */
@RestController
@CrossOrigin
@Api(description = "权限管理")
@RequestMapping("/module")
public class SysModuleController {

    @Autowired
    private ISysModuleService iSysModuleService;
    @ApiOperation("树结构")
    @PostMapping("/tree")
    public TreeNode tree(){
        return iSysModuleService.tree();
    }

    @ApiOperation("分页加条件")
    @PostMapping("/search")
    public PageResult<SysModule> search(@RequestBody PageDTO<SysModule> pageDTO){
        return iSysModuleService.search(pageDTO);
    }
    @PostMapping("/save")
    public Result addAndUpdate(@RequestBody SysModule sysModule){
        return iSysModuleService.add(sysModule);
    }
    @PostMapping("delById")
    public Result delById(@RequestBody SysModule sysModule){
        return iSysModuleService.delById(sysModule);
    }

}
